﻿using System.Configuration;
using System.Diagnostics.CodeAnalysis;

namespace LiveNet.Configuration
{
    public sealed class AuthorizationConfigElement<T> : ConfigurationElement
        where T : struct
    {
        [ConfigurationProperty("permissionReturnUrl", IsRequired=true)]
        [SuppressMessage("Microsoft.Design", "CA1056:UriPropertiesShouldNotBeStrings")]
        public string PermissionReturnUrl
        {
            get { return (string)this["permissionReturnUrl"]; }
            set { this["permissionReturnUrl"] = value; }
        }

        [ConfigurationProperty("privacyUrl", IsRequired = true)]
        [SuppressMessage("Microsoft.Design", "CA1056:UriPropertiesShouldNotBeStrings")]
        public string PrivacyUrl
        {
            get { return (string)this["privacyUrl"]; }
            set { this["privacyUrl"] = value; }
        }

        [ConfigurationProperty("permissionString", IsRequired = true)]
        public T PermissionString
        {
            get { return (T)this["permissionString"]; }
            set { this["permissionString"] = value; }
        }

        [ConfigurationProperty("useHttps", IsRequired = false, DefaultValue=true)]
        public bool UseHttps
        {
            get { return (bool)this["useHttps"]; }
            set { this["useHttps"] = value; }
        }
    }
}
